
#ifndef _MEMBER_BCONEARRESTRAINT_H_
#define _MEMBER_BCONEARRESTRAINT_H_

#include <BNode>
#include <BConearRestraint>

#define conear_member(conear)		((member_BConearRestraint*)((BConearRestraint*)conear)->_ptr)

namespace BWE
{
	class member_BConearRestraint
	{
	public:
		member_BConearRestraint(BConearRestraint* restraint);
		~member_BConearRestraint();

		void calculateAngleInfo();
		BReal atan2Fast(BReal y, BReal x);

		BRestraint*		boss;
		BVector			axisA;
		BVector			axisB;
		BMatrix			frameA;
		BMatrix			frameB;
		BVector			horAxis;
		BVector			verAxis;

		BReal			biasFactor;
		BReal			damping;

		BReal			swingSpan1;
		BReal			swingSpan2;
		BVector			coneAxis;
		BVector			swingAxis;
		bool			solveSwingLimit;

		BReal			twistSpan;
		BVector			twistAxis;
		bool			solveTwistLimit;

		BReal			twistLimitSign;
		BReal			swingError;
		BReal			twistError;
		BReal			twistAngle;

		BReal			accSwingLimitImpulse;
		BReal			accTwistLimitImpulse;

		BReal			swingLimitRatio;
		BReal			twistLimitRatio;

		bool			motorEnabled;
		bool			bNormalizedMotorStrength;
		BQuater			target;
		BReal			maxMotorImpulse;
		BVector			accMotorImpulse;
	};
}

#endif
